package com.bop.dehong.base;

import java.io.File;

import com.bop.dehong.R;

import android.content.Context;
import android.os.Environment;

public class AppContext {
	private static String getCacheRootDir(Context context) {
		return Environment.getExternalStorageDirectory() + File.separator
				+ context.getString(R.string.app_name);
	}

	/**
	 * @describe:TODO 创建数据库文件的路径
	 * @param dbpath
	 * @param dbName
	 * @return
	 */
	public static File getCachePath(Context context) {
		File path = new File(Environment.getExternalStorageDirectory(),
				getCacheRootDir(context));// 创建目录
		if (!path.exists()) {// 目录存在返回false
			path.mkdirs();// 创建�?个目�?
		}
		return path;
	}

	/**
	 * @title: getCacheRootDir
	 * @description: TODO获取本系统在SDCard中的缓存的根路径
	 * @return File
	 * @throws
	 */
	public static File getCacheRootDirFile(Context context) {
		File dir = new File(getCacheRootDir(context));
		if (!dir.exists() || !dir.isDirectory())
			dir.mkdirs();
		return dir;
	}
}
